package com.study.leetcode;

public class Solution_258 {
    public static int addDigits(int num) {
        int sum;
        while (num >= 10) {
            sum = 0;
            while (num > 0) {
                sum += num % 10;
                num /= 10;
            }
            num = sum;
        }
        return num;
    }

    public static void main(String[] args) {
        int i = addDigits(10000);
        System.out.println("i = " + i);
    }

}
